<template>
	<view class="">
		<view class="pd pt20 pm20 bgff bbm">
			<view class="display-flex cen">
				<view class="flex-1 fz32" @tap="jxxzcfd(sd)" v-for="sd in jmxcsd">
					<text class="pr" :class="sd.cls?'xzczxetry':''">{{sd.label}}</text>
					<text class="fz24 z9 ml10">({{sd.number}})</text>
				</view>
			</view>
		</view>
		<view class="btm mt20 btm bgff pd pt20 pm20">
			<view class="table w100 fz24 z3 cen">
				<view class="trow fz26 gfdxcvxert dfczxctrt">
					<view class="cell">
						姓名
					</view>
					<view class="cell">
						入职企业
					</view>
					<view class="cell">
						借款金额
					</view>
					<view class="cell">
						审批状态
					</view>
					<view class="cell">
						提交日期
					</view>
				</view>
				<template v-for="sd in jdcdx">
					<view class="trow z6 gfdxcvxert" >
						<view class="cell">
							{{sd.realName}}
						</view>
						<view class="cell">
							<view class="dian dfsdfxcxzrew">
								{{sd.companyName}}
							</view>
						</view>
						<view class="cell">
							￥{{sd.balance}}
						</view>
						<view class="cell">
							<text v-if="sd.isPass==1" class="z9">待审核</text>
							<text v-if="sd.isPass==2" class="ls">审核通过</text>
							<text v-if="sd.isPass==3" class="red">审核不通过</text>
						</view>
						<view class="cell">
							{{transferTimeYMD(sd.createTime)}}
						</view>
					</view>
				</template>
				

			</view>
			
			
			<view class="vertical-center mt100" v-if="jdcdx.length<=0">
			
					<image src="../../static/img/noData.png" class="xczxcertfdgtrr"></image>
					<view class="mt20 z9 fz24">
						暂无数据!
					</view>
			
			</view>
		</view>
	</view>
</template>
<script lang="ts" setup>
	import { ref } from "vue"
	import { onLoad } from "@dcloudio/uni-app"
	import { hf, callBack, dxrequest,transferTimeYMD,kmxzcf } from "@/util/index.js"
	const idxs = ref(0)
	const jdcdx = ref([])
	
	const jmxcsd = ref([
		{
			label: "全部",
			value: 0,
			number: 0,
			cls: "act"
		}, {
			label: "审核中",
			value: 1,
			number: 0,
			cls: ""
		},{
			label: "通过",
			value: 2,
			number: 0,
			cls: ""
		}, {
			label: "拒绝",
			value: 2,
			number:0,
			cls: ""
		}, 
	])
	const jxxzcfd = (data) => {
		idxs.value = data.value
		jmxcsd.value.map(a => {
			a.cls = ""
		})
		data.cls = "act"
	}

	const initsd = async()=>{
		const {data} = await dxrequest("/api/userbalancelog/page",{
			recordType:3,
			page:1,
			limit:999
		})
		jdcdx.value = data.list
		data.list.map(a=>{
			if(a.isPass==1){
				jmxcsd.value[1].number++
			}
			if(a.isPass==2){
				jmxcsd.value[2].number++
			}
			if(a.isPass==3){
				jmxcsd.value[3].number++
			}
		})
		
		jmxcsd.value[0].number = data.list.length
	}
	onLoad(()=>{
		initsd()
	})
</script>

<style scoped>
	.dfsdfxcxzrew {
		max-width: 200rpx;
		text-align: center;
	}

	.gfdxcvxert {
		line-height: 2.4;
	}

	.dfczxctrt {
		background: #f2f2f2;
	}
</style>